package com.atyun;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * beanPostProcess后置处理阶段，需要将所有初始化之后的bean放入到map中
 * @Author: 云水瑶
 * @Date: 2025/4/26
*/
public class DtpBeanPostProcess implements BeanPostProcessor {

    /**
     * bean后置处理阶段执行方法
     * 需要将所有初始化后的Executor.class对象放入map中
     * @Author: 云水瑶
     * @Date: 2025/4/26
    */
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {

        if(bean instanceof DptExecutor) {
            System.out.println("bean初始化执行postProcess后置方法阶段：将所有初始化后的bean放入map中");
            DtpUtil.put(beanName, (DptExecutor) bean);
        }
        return bean;
    }

}
